/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package tdtest.action;

import tdtest.controls.ControlFactory;
import tdtest.data.TDGroup;

/**
 *
 * @author sutter
 */
public class AddGroupItem<T> implements Action {
	
	private TDGroup<T> group;
	private ControlFactory<T> controlFactory;
	
	public AddGroupItem(TDGroup<T> group, ControlFactory<T> controlFactory) {
		this.group = group;
		this.controlFactory = controlFactory;
	}
	
	public void run() {
		T data = controlFactory.createObject();
		group.groupItems.add(data);
		group.onUpdate();
	}
	
}
